$(function() {

	$('.driverDatabaseTypeChangeEvent').change(
			function() {
				var type = $(this).val();
				var url = $(this).parent().parent().next().find(
						"textarea[name='url']");
				changeDriverDataBaseUrl(type, url);
			});

	// 初始化select2插件
	$(".select-control").select2({
		theme : "classic",
		// Infinity展示的Option个数不限制
		minimumResultsForSearch : Infinity
	});
});

// 数据库驱动与URL模板联动切换
function changeDriverDataBaseUrl(type, url) {
	if (type == "com.mysql.jdbc.Driver") {
		url.val('jdbc:mysql://127.0.0.1:3306/test?seUnicode=true&characterEncoding=UTF8&amp;&useSSL=true');
	} else if (type == "oracle.jdbc.OracleDriver") {
		url.val('jdbc:oracle:thin:@127.0.0.1:1521:ORCL');
	}
}